import { http } from "@/utils/http";
import { ClientModel } from "@/api/model/clientModel";
import { PageResponse } from "@/api/model/baseModel";

enum Api {
  ClientList = "/client/list",
  ClientAdd = "/client/add",
  ClientUpdate = "/client/update",
}

export function getClientList(param: ClientModel) {
  return http.get<PageResponse<ClientModel>>({
    url: Api.ClientList,
    params: param,
  });
}

export function changeState(id: string, state: boolean) {
  return http.post<Boolean>({
    url: `/client/state/${id}/${state}`,
  });
}

export function addClient(param: ClientModel) {
  return http.post<string>({
    url: Api.ClientAdd,
    params: param,
  });
}

export function updateClient(param: ClientModel) {
  return http.post<boolean>({
    url: Api.ClientUpdate,
    params: param,
  });
}

export function resetClientSecret(id: string) {
  return http.post<string>({
    url: `/client/resetSecret/${id}`,
  });
}
export function deleteClient(id: string) {
  return http.post<string>({
    url: `/client/deleteClient/${id}`,
  });
}
